package org.example.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.model.Admin;
import org.example.model.Menu;

import java.util.List;

public interface AdminDao {
    //查询管理员信息
    List<Admin> searchAllAdmins(Admin admin);

    //查询所有菜单
    @Select("select id,name from menu where type = 2")
    List<Menu> searchAllMenus();

    //新增管理员
    void insertAdmin(Admin admin);

    @Insert("insert into admin_menu(adminid,menuid) values(#{adminid},#{menuid})")
    void insertAdminMenu(@Param("adminid") Integer id, @Param("menuid")Integer menuId);

    Admin findAdminById(Integer id);

    void updateAdmin(Admin admin);

    void deleteAdminMenu(Integer id);

    void deleteAdminById(Integer id);
}
